var canConstruct = function(ransomNote, magazine) {
    if(ransomNote.length > magazine.length) {
        return false
    }
    const indexArr = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
    let rArr = new Array(26).fill(0)
    let mArr = new Array(26).fill(0)
    let result = true
    // console.log(rArr)
    for(item of ransomNote) {
        rArr[indexArr.indexOf(item)] ++
    }
    for(item of magazine) {
        mArr[indexArr.indexOf(item)] ++
    }
    for(index in rArr) {
        if(rArr[index] > mArr[index]) {
            result = false
            break
        }
        console.log(index,rArr[index])
    }
    return result
};



console.log(canConstruct('fihjjjjei','hjibagacbhadfaefdjaeaebgi'))